package com.sunni.controller;

import com.sunni.entity.Permission;
import com.sunni.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @RequestMapping("/selectAllPermission")
    @ResponseBody
    public List<Permission> selectAllPermission(){
        return permissionService.selectAll();
    }


    /**
     *   角色管理，点击编辑，角色权限datagrid栏 数据回显。
     * @param rid
     * @return
     */
    @RequestMapping("/selectAllByRid")
    @ResponseBody
    public List<Permission> selectAllByRid(Long rid){
//        System.out.println("rid = " + rid);
        return permissionService.selectAllByRid(rid);
    }

}
